
//
//  UILabel+Extension.swift
//  SinaWeibo
//
//  Created by apple on 15/11/13.
//  Copyright © 2015年 apple. All rights reserved.
//

import UIKit

extension UILabel {
    
    convenience init(title:String,size:CGFloat,color:UIColor,margin:CGFloat = 0) {
        
        self.init()
        
        numberOfLines = 0
        
        text = title
        
        textAlignment  = NSTextAlignment.Center
        
        font = UIFont.systemFontOfSize(size)
        
        textColor = color
        
        if margin != 0 {
            
            preferredMaxLayoutWidth = screenWidth - 2 * margin
            
            textAlignment = .Left
        }
        
        sizeToFit()

    }
    
}
